#include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_set>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<queue>
#include<climits>
#include<stack>

using namespace std;
typedef long long ll;
#define INF 1000000000.0
#define EPS 0.0000001

template<typename T> 
inline void read(T &x){
	x=0;T f=1;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

int euler_phi(int n){
  int m=int(sqrt(n+0.5));
  int ans=n;
  for(int i=2;i<=m;i++){
    if(n%i==0){
      ans=ans/i *(i-1);
      while(n%i==0)n/=i;
    }
  }
  if(n>1)ans=ans/n*(n-1);
  return ans;
}

int main(){
    #ifdef BUG
    freopen("a.in","r",stdin);
    #endif
    int n;
    while(cin>>n){
      cout<<euler_phi(n)<<endl;
    }
}
